<!DOCTYPE html>
<html class="x-admin-sm">
  <head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link rel="stylesheet" href="__ADMIN__/css/font.css">
    <link rel="stylesheet" href="__ADMIN__/css/xadmin.css">
    <script type="text/javascript" src="__ADMIN__/js/jquery.min.js"></script>
    <script type="text/javascript" src="__ADMIN__/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="__ADMIN__/js/xadmin.js"></script>
    <script type="text/javascript" src="__ADMIN__/js/cookie.js"></script>
    <style>
        .layui-btn+.layui-btn{
            margin-left: 0;
        }
        .layui-table td, .layui-table th
        {
            min-width: 50px !important;
        }
    </style>
  </head>
  
  <body>
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a><cite>{$nav}</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon layui-icon-refresh-3" style="line-height:30px"></i></a>
    </div>
    <div class="x-body x-admin">
        {if session('group_id','','admin') == 1 || session('group_id','','admin') == 8}
      <xblock>
          <button style="float:left;" class="layui-btn" onclick="x_admin_show('新增','{:url('Article/edit')}',false,'750','800')">新增</button>
      </xblock>
      {/if}
      <div class="layui-table-body layui-table-main" style="width: 100%;">
      <table class="layui-table layui-form">
        <thead>
          <tr>
            <!--<th width="60">id</th>-->
            <th>标题</th>
            <th width="60">分类</th>
            <!--<th width="80">发布人</th>-->
            <th width="80">添加时间</th>
            <th width="60">状态</th>
            <th width="150" style="text-align: center;">操作</th>
        </thead>
        <tbody>
          {volist name="list" id="v"}
          <tr>
            <!--<td>{$v.id}</td>-->
            <td>{$v.is_top?'[置顶]':''}{$v.title}</td>
            
            <td>{:idToCateName($v.cate_id)}</td>
            <!--<td>{:idToAdminname($v.admin_id)}</td>-->
            <td>{$v.add_time|date="Y-m-d",###}</td>
            <td>已发布</td>
            <td class="td-manage" style="text-align: center;">
              <a title="查看" class="layui-btn layui-btn-normal layui-btn-xs" onclick="x_admin_show('{$v.title}','{:url('article/view')}/id/{$v.id}',true,'750','800')" href="javascript:;">
                查看
              </a>
              {if session('group_id','','admin') == 1  ||  session('group_id','','admin') == 8 }
              <a title="编辑" class="layui-btn layui-btn-normal layui-btn-xs" onclick="x_admin_show('文章编辑','{:url('article/edit')}/id/{$v.id}',false,'750','800')" href="javascript:;">
                编辑
              </a>
              <a title="删除" class="layui-btn layui-btn-danger layui-btn-xs" lay-filter="cancel" lay-submit="" lay-id="{$v.id}" href="javascript:;">
                删除
              </a>
              {/if}
              
            </td>
          </tr>
          {/volist}
        </tbody>
      </table>
    </div>
      <div class="page">
        <div>
          {$list->render()}
        </div>
      </div>
    </div>

    <script>
      layui.use(['form','layer','jquery'], function(){
        form = layui.form,
        layer = layui.layer
        ,$ = layui.jquery;
        
        form.on('submit(cancel)', function(data){
            var id = $(this).attr('lay-id');
            layer.confirm('确定将该客户进行回收吗？', {icon: 3, title:'回收操作'}, function(index){
                //do something
                $.ajax({
                    type:'POST',
                    dataType:'json',
                    data:{id:id},
                    url:"{:url('article/del')}",
                    success:function(obj){
                      layer.msg(obj.msg, {icon: obj.icon,time: 2000},function(){
                            location.reload();
                      });
                    }
                });
              layer.close(index);
            });
            return false;
        });
      });

    </script>
  </body>

</html>